<?php

class Ruta extends AppModel {

    public $label = 'Rutas';
    public $tablePrefix = 'sub_';
    public $useTable = 'rutas';
    public $displayField = 'id';
    public $virtualFields = array(
        'tmp_id' => 'id'
    );
    public $recursive = -1;
    public $hasAndBelongsToMany = array(
        'Subsidio' => array(
            'className' => 'Subsidio',
            'joinTable' => 'sub_subsidios_rutas',
            'foreignKey' => 'ruta_id',
            'associationForeignKey' => 'subsidio_id',
            'unique' => true
        )
    );
    public $validate = array(
        'realizada' => array(
            'required' => array(
                'rule' => array('notEmpty'),
                'message' => 'Debe indicar si la ruta se encuentra realizada'
            )
        )
    );

}